Repository navigation
fix(migrations): make 038 run on utf8mb4_unicode_ci schemas - #1159
Open
linus-liu-web wants to merge 1 commit into
Open
linus-liu-web wants to merge 1 commit into
linus-liu-web wants to merge 1 commit into
Conversation
compose.yaml starts MySQL with --collation-server=utf8mb4_unicode_ci, so generic_templates.id is utf8mb4_unicode_ci, while JSON_TABLE returns its string columns with the server default utf8mb4_0900_ai_ci. The join in 038 compares the two directly and aborts the whole script with ERROR 1267 (HY000): Illegal mix of collations (utf8mb4_0900_ai_ci,IMPLICIT) and (utf8mb4_unicode_ci,IMPLICIT) for operation '=' so the documented upgrade step leaves every row unchanged on Compose. Compare both sides of the join under one explicit collation, which works on schemas that inherited either collation.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
migrations/038_generic_sop_host_credentials.sqlaborts on the default Compose database:compose.yamlstarts MySQL with--collation-server=utf8mb4_unicode_ci, sogeneric_templates.idisutf8mb4_unicode_ci, whileJSON_TABLEreturns itsagent_idcolumn with the server's default collationutf8mb4_0900_ai_ci. The joina.agent_id = CONCAT(t.id, '-mr')fails with ERROR 1267, so the whole script aborts and no row is rewritten. On a MySQL server whose default collation isutf8mb4_0900_ai_cithe same statement succeeds, which is why this only shows up on Compose.docs/deployment.mdtells operators upgrading from an earlier release to apply this script after the Git credential migration, so the documented upgrade path is broken for Compose deployments whose built-in MR roles still carry the old instruction.The fix compares both sides of the join under one explicit collation:
utf8mb4_unicode_ciexists on every server that supportsJSON_TABLE, so the script now runs whether the schema inheritedutf8mb4_unicode_ci(Compose default) orutf8mb4_0900_ai_ci(MySQL 8 server default). The comment above the statement records the reason.Scope
Compatibility
No schema change: the statement rewrites
generic_templates.payloadfor the three built-in MR roles under the same predicate as before, and remains a no-op when no row carries the old instruction. The compared ids (generic-*-mr,issue-fix-production-mr) are ASCII, so the explicit collation does not change matching behavior.Validation
Applied to MySQL 8.4 (the image
compose.yamlpins) in scratch databases seeded with the three built-in template rows carrying the oldAGENTFLOW_GIT_TOKENinstruction:utf8mb4_unicode_ci(Compose default)UPDATEutf8mb4_0900_ai_ci(MySQL 8 server default)An unrelated agent prompt in the same payload stayed unchanged,
SELECT COUNT(*) ... WHERE payload LIKE '%AGENTFLOW_GIT_TOKEN%'returned 0 afterwards, and a second run updates nothing.python3 scripts/check-public.pypasses.go test -p=2 ./...); no Go code changed.Safety